package com.cms.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cms.entity.Guestbook;
import com.cms.mapper.GuestbookMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cms.utils.DbUtils;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 会员表 服务实现类
 * </p>
 *
 * @author songfayuan
 * @since 2021-11-12
 */
@Service
public class GuestbookService extends ServiceImpl<GuestbookMapper, Guestbook> {

    /**
     * 查找留言分页
     *
     * @param pageNumber
     *            页码
     * @param pageSize
     *            每页记录数
     * @param siteId
     *            站点ID
     * @return 留言分页
     */
    public Page<Guestbook> findPage(Integer pageNumber, Integer pageSize, Integer siteId){
        QueryWrapper<Guestbook> queryWrapper = new QueryWrapper();
        queryWrapper.eq("siteId",siteId);
        queryWrapper.orderByDesc("createDate");
        return baseMapper.selectPage(new Page<>(pageNumber, pageSize),queryWrapper);
    }
}
